class Article < ActiveRecord::Base
  attr_accessible :name, :description, :picture, :prize, :category_id
  
  #código para editar, en style puedo configurar el tamaño según yo quiera
  has_attached_file :picture, :styles => { :medium => "300x300>", :thumb => "100x100>" }, :default_url => "/images/:style/missing.png"
  

  belongs_to :category

  validates :name, :description, :prize, presence: true
  validates :prize, numericality: true

  validates_attachment :picture, :presence => true,
  :content_type => { :content_type => ["image/jpg", "image/png", "image/jpeg"] },
  :size => { :in => 0..2048.kilobytes }
end
